package hapinvion.android;

import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.util.Log;
import android.view.View;
import com.talk.phonedetectlib.PhoneDetectListener;
import com.talk.phonedetectlib.PhoneDetectSDK;


public class MainActivity extends ActionBarActivity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initUI();

        PhoneDetectSDK.getInstance().setAppKey("uL63NkSa6x6n67Ytv7fts60IxJ4nf7KE");
    }

    private void initUI() {
        findViewById(R.id.btn_detector).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View arg0) {

                PhoneDetectSDK.getInstance().startHardwareDetect(MainActivity.this, new PhoneDetectListener() {
                    @Override
                    public void onResult(int code, String value) {
                        Log.e("test", value);
                    }
                });

            }
        });

        findViewById(R.id.btn_battery).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View arg0) {

                PhoneDetectSDK.getInstance().startBatteryDetect(MainActivity.this);

            }
        });
    }
}
